package com.li.springbootproject.service.spring;

import com.li.springbootproject.service.test.TestService;
import com.li.springbootproject.service.user.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

/**
 * @author LiDong
 * @version 1.0.0
 * @className BeanInjectionServiceImpl.java
 * @createTime 2021年09月04日 20:46:00
 */
@Service
public class BeanInjectionServiceImpl implements BeanInjectionService {

    private static final Logger logger = LoggerFactory.getLogger(BeanInjectionServiceImpl.class);

    /**
     * 构造方法注入 Bean
     */
    private final UserService userService;

    /**
     * Set 方法注入 Bean
     */
    private TestService testService;

    public BeanInjectionServiceImpl(UserService userService) {
        logger.info("=====> 构造方法注入 Bean!");
        this.userService = userService;
    }

    public void setTestService(TestService testService) {
        this.testService = testService;
    }

    @Override
    public void test1() {
        logger.info("当前的 UserServiceBean :{}", userService);
        logger.info("当前的 TestService :{}", testService);

    }
}
